'''列表拷贝'''
import copy

name1 = ["张三","李四","王五","赵六","陈七"]
name2 = name1.copy()#复制列表值
name1[2] = "随便"

print(name1)
print(name2)

print("-------------------------------")
name1 = [["赵茜","刘涛"],"王二","珊珊"]
name2 = name1.copy()#（浅拷贝）当列表的元素是一个列表时，复制的是元素的地址
name1[0][0] = "窝窝"
name1[1] = "破皮"

print(name1)
print(name2)


print("-------------------------------")
name1 = [["赵茜","刘涛"],"王二","珊珊"]
name2 = copy.copy(name1)#(浅拷贝)当列表的元素是一个列表时，复制的是元素的地址
name1[0][0] = "窝窝"
name1[1] = "破皮"

print(name1)
print(name2)

print("-------------------------------")
name1 = [["赵茜","刘涛"],"王二","珊珊"]
name2 = copy.deepcopy(name1)#（深拷贝）会拷贝列表中的值
name1[0][0] = "宋士"
name1[1] = "芳芳"
print(name1)
print(name2)

